$(function(){
    //设置喜欢页面ul高度
    var wh=$(window).height()-$(".portrait_box").height()-$(".weui-tabbar").height()-$(".weui-navbar").height()-45
    $('.weui-mark,.weui-tab__content').css('height',wh)
    initLeft();

    var num=1;
    var swiperv = new Swiper('.swiper-container-h', {
        direction: 'vertical',
        on:{slideChangeTransitionEnd: function() {
            for(var i in swiperh){
                if(swiperv.realIndex==i){
                    swiperh[i].slideTo(0, 500, true);
                }
            }
        }
        }
    });
    var swiperh =null;
    function initLeft() {
        //swiper切换
        swiperh = new Swiper('.swiper-container-v', { //左右切换
            pagination: {
                el: '.swiper-pagination-v',
                clickable: true,
            },
            spaceBetween: 50,
            autoplay: {
                delay: 3000,
                disableOnInteraction: false
            },
            paginationClickable: true,
        })
    }

//点击弹出详情
    $('.role_per').click(function() {
        for(var i in swiperh){
            if(swiperv.realIndex==i){
                swiperh[i].autoplay.stop();

            }
        }
        $(".mask").fadeIn(50)
        $('.getAdd').fadeIn()
        $(this).css("width", "100%")
        $(this).animate({
            top: '5.5rem'
        }, 200);
    });
//关闭详情
    function role_per_hide(){
        for(var i in swiperh){
            if(swiperv.realIndex==i){
                swiperh[i].autoplay.start();

            }
        }
        $('.getAdd').fadeOut(50)

        $('.role_per').css({
            "width": "90vw"
        })

        var top_h = $('.weui-tabbar').offset().top - 79;
        $('.role_per').animate({
            top: top_h
        }, 200);

    }

//关闭弹窗
    $('.mask').click(function() {
        $(this).fadeOut(50)
        role_per_hide()
        system_messages_hide()
    })
//顶部tab切换

    $('.weui-navbar__item').on('click', function () {
        $(this).addClass('tab-pink').siblings('.tab-pink').removeClass('tab-pink');
        $(jQuery(this).attr("href")).show().siblings('.weui-tab__content').hide();
    });
//弹出系统消息function
    function system_messages(){
        $(".mask").fadeIn(50)
        $('.system_messages').animate({
            bottom: '-5rem'
        }, 200);
    }
    function system_messages_hide(){

        $('.system_messages').animate({
            bottom: '-100%'
        }, 200);
    }
//标签多选
    $(".weui-form").find("label") .click(function(){
        if($(this).hasClass("selected")==false){
            $(this).addClass("selected");
        }else{
            $(this).removeClass("selected");
        }


    })
})
